<?php
/** $Id: default_form.php 11917 2009-05-29 19:37:05Z ian $ */
	defined( '_JEXEC' ) or die( 'Restricted access' );
	$session = JFactory::getSession();
	$app = JFactory::getApplication();
	$template = JURI::base() . 'templates/' . $app->getTemplate();
	
	$user		= JFactory::getUser();
	$is_user = false; 
	$is_user_caterer = false; 
	foreach ($user->groups as $key => $value){
		if($value==9) {
			$is_user_caterer = true; 
		}
		if($value==2) {
			$is_user = true; 
		}
	}
?>
<div id="header">
  <div id="w-header">
    <div class="logo"><a href="index.php">Forside</a> </div>
    <!--.logo-->
     {module login menu}    
    <!--.nav-top-1-->
    <div class="clear"></div>
    <div class="main-nav">
      {module main menu}
    </div>
    <!--.main-nav-->
    <div class="clear"></div>
  </div>
  <!--#w-header--> 
</div>
<!--#header-->

<div id="main">
  <div id="w-main">
    <div id="main-left">
	<div class="left-find"></div>
	<div class="right-find"></div>
		<div class="find">
			{module search}
		</div> 
      <!--.find-->
      <div class="clear"></div>
      <div class="infomation">
		<?php $article = JUtility::getArticle(15); ?>
        <h2><a href="#"><?php echo $article->title; ?></a></h2>
        <?php echo $article->introtext; ?>
      </div>
      <!--.infomation--> 
    </div>
    <!--#main-left-->
    <div id="main-right2">
      <div id="cateringsvirksomhed-page">
        <div class="god-content">
          <form name="rmuserordernew" id="rmuserordernew" action="index.php?option=com_jobs" method="post">
          <!--title4-->
           <?php 
		   if(isset($this->orders_new)&& count($this->orders_new)>0) {	 
				 //$order_first = $this->model->getOrder($this->order->jobid);
				 //$order_user_first = $this->model->getUserInfo($order_first->userid);
				 //$order_catering_first = $this->model->getUserInfo($this->order->catererid);
			?>
          <div class="previous-order no-m-t">
          	<div class="title3">
            	<h1>ordrer sendt</h1>
                <div class="see-all"><a href="<?php echo JRoute::_('index.php?option=com_jobs&view=indholdnew&see=all');?>">Se all <span>(<?php echo $this->orders_new_total;?>)</span></a></div><!--see-all-->
            </div><!--.title3-->
            <div class="previous-order-content2">
            
            <?php foreach($this->orders_new as $item) { ?>
            
            	<div class="order-item">
            <div class="order-item-top"></div>
            <!--.order-item-top-->
            <div class="order-item-mid">
            	<div class="order-info-left2">
                  <h3><a href="<?php echo JRoute::_('index.php?option=com_jobs&view=eventdetail&eventid='.$item->id);?>"><?php echo $item->title; ?></a></h3>
                  <p><?php echo JHTML::_('string.truncate', ($item->description), 180); ?></p>
              </div><!--.order-info-left-->
              <div class="order-info-right2">
              	<div class="num-guests">
                	<img src="templates/kokketilbud/images/icon-people.png" width="18" height="18" alt="">
                    <p>Antal gæster: <span><?php echo $item->guests; ?></span></p>
                </div><!--.num-guests-->
                <div class="address-info">
                	<img src="templates/kokketilbud/images/icon-home.png" width="18" height="18" alt="">
                    <p><span><?php echo $item->city; ?></span></p>
                </div><!--.address-info-->
                <div class="timer">
                	<img src="templates/kokketilbud/images/icon-timer.png" width="18" height="18" alt="">
                    <p><span><?php  echo JFactory::getDate($item->deadline)->toFormat('%m-%d-%Y'); ?></span></p>
                </div><!--.timer-->
              </div><!--.order-info-right-->
              <div class="checked">
              	<input class="removeordernew" type="checkbox" value="<?php echo $item->id; ?>"  name="removeordernew[]">
              </div><!--.checked-->
            </div>
            <!--.order-item-mid-->
            <div class="order-item-bottom"></div>
            <!--.order-item-bottom--> 
          </div>
          <!--.order-item-->
          <?php } ?>
          <input type="hidden" name="task" value="rmuserordernew" />
		  <?php echo JHtml::_('form.token'); ?>   
          
          <div class="bnt-del">
          	<a  onclick="ordernewremove()">Slette</a>
          </div><!--.bnt-del-->
          
            </div><!--.previous-order-content2-->
          </div>
          <?php } ?>
          </form>
          
          
          
          
          <?php if(count($this->items)>0) { ?> 
          <div class="previous-order">
          	<div class="title3">
            	<h1>ældre ordrer</h1>
                <div class="see-all"><a href="<?php echo JRoute::_('index.php?option=com_jobs&view=indholdcaterer&see=all');?>">Se all <span>(<?php echo count($this->items_total);?>)</span></a></div><!--see-all-->
            </div><!--.title3-->
            <div class="previous-order-content2">
            <form name="rmcatererorder" id="rmcatererorder" action="index.php?option=com_jobs" method="post">
            <?php foreach($this->items as $item) : ?>
            <?php 
				 $order = $this->model->getOrder($item->jobid);
			?>
            	<div class="order-item">
            <div class="order-item-top"></div>
            <!--.order-item-top-->
            <div class="order-item-mid">
            	<div class="order-info-left2">
                  <h3><a href="<?php echo JRoute::_('index.php?option=com_jobs&view=detail&eventid='.$item->id);?>"><?php echo $item->title; ?></a></h3>
                  <p><?php echo JHTML::_('string.truncate', ($order->description), 180); ?></p>
              </div><!--.order-info-left-->
              <div class="order-info-right2">
              	<div class="num-guests">
                	<img src="templates/kokketilbud/images/icon-people.png" width="18" height="18" alt="">
                    <p>Antal gæster: <span><?php echo $order->guests; ?></span></p>
                </div><!--.num-guests-->
                <div class="address-info">
                	<img src="templates/kokketilbud/images/icon-home.png" width="18" height="18" alt="">
                    <p><span><?php echo $order->city; ?></span></p>
                </div><!--.address-info-->
                <div class="timer">
                	<img src="templates/kokketilbud/images/icon-timer.png" width="18" height="18" alt="">
                    <p><span><?php  echo JFactory::getDate($order->deadline)->toFormat('%d-%m-%Y'); ?></span></p>
                </div><!--.timer-->
              </div><!--.order-info-right-->
              <div class="checked">
              	
              	<input  class="removeorder" name="removeorder[]" type="checkbox" value="<?php echo $item->id;?>" />
                
              </div><!--.checked-->
            </div>
            <!--.order-item-mid-->
            <div class="order-item-bottom"></div>
            <!--.order-item-bottom--> 
          </div>
          <!--.order-item-->
          <?php endforeach; ?>
          <input type="hidden" name="see" value="<?php echo JRequest::getVar('see');?>" />
          <input type="hidden" name="task" value="removeCatererOrders" />
		  <?php echo JHtml::_('form.token'); ?>   
          </form>    
          <div class="bnt-del">
          	
           		<a  onclick="catererremove()">Slette</a>
           
          </div><!--.bnt-del-->
          
            </div><!--.previous-order-content2-->
          </div><!--.previous-order-->
           <?php } ?>
          
          <script type="text/javascript">
		  function ordernewremove()
		   {
			   if(jQuery(".removeordernew").is(":checked")) {
			   		jQuery('#rmuserordernew').submit();
			   } else {
				    jQuery('#alert').html('Vælg for at fjerne !');
					jQuery('#backoverlay').show();
					jQuery('#show_popup').show();
			   }
		 	}
         
          
		  function catererremove()
		   {
			   if(jQuery(".removeorder").is(":checked")) {
			   		jQuery('#rmcatererorder').submit();
			   } else {
				    jQuery('#alert').html('Vælg for at fjerne !');
					jQuery('#backoverlay').show();
					jQuery('#show_popup').show();
			   }
		 	}
          </script>
          <div class="line"></div>
          
                  
        </div>
        <!--.god-content--> 
      </div>
      <!--#cateringsvirksomhed-page--> 
    </div>
    <!--#main-right--> 
  </div>
  <!--#w-main--> 
</div>
<!--#main-->
<div class="clear"></div>
<div id="contact">
  <div id="w-contact">
    <div class="left-con">
      <div class="left-con-top"></div>
      <!--left-con-top-->
      <div class="left-con-mid">
        <div class="contact-con">
		<?php $article = JUtility::getArticle(17); ?>
          <h2><a href="#"><?php echo $article->title; ?></a></h2>
          <?php echo $article->introtext; ?>
        </div>
        <!--.contact-con-->
        <div class="contact-con contact-con2">
			<?php $article = JUtility::getArticle(18); ?>
			<h2><a href="#"><?php echo $article->title; ?></a></h2>
			<?php echo $article->introtext; ?>
        </div>
        <!--.contact-con--> 
      </div>
      <!--left-con-mid-->
      <div class="left-con-bottom"></div>
      <!--left-con-bottom--> 
    </div>
    <!--.left-con-->
    
    <div class="address">
		<?php $article = JUtility::getArticle(16); ?>
		<h2><?php echo $article->title; ?></h2>
		<?php echo $article->introtext; ?>
    </div>
    <!--address--> 
    
    <div class="contact-form">
		{module kontakt}
    </div><!--.contact-form-->
  </div>
  <!--w-contact--> 
</div>
<!--#contact-->
<div class="clear"></div>
<div id="copyright">
	<div id="w-copyright">
		{module footer}
	</div>
</div>
<!--#copyright-->